﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;

namespace DAL
{
    public abstract class HanghoaDAL:BaseDAL,IBase
    {
        #region IBase Members

        public int Count()
        {
            throw new NotImplementedException();
        }

        public object Select(string code)
        {
            throw new NotImplementedException();
        }

        public System.Data.DataTable Select(Guid fKey)
        {
            throw new NotImplementedException();
        }

        public System.Data.DataTable Select(object obj, int skip, int take)
        {
            throw new NotImplementedException();
        }

        public object Insert(object obj)
        {
            throw new NotImplementedException();
        }

        public object Update(object obj)
        {
            throw new NotImplementedException();
        }

        public object Delete(Guid id)
        {
            throw new NotImplementedException();
        }

        #endregion

        public DataTable Hanghoa_Select_All_Vali()
        {
            return Mapper.QueryForDataTable("Hanghoa_Select_All_Vali", null, "Temp");
        }

        public void Hanghoa_Select_All_Vali_ForView()
        {
             Mapper.QueryForDataTable1("Hanghoa_Select_All_Vali_ForView", null, "Temp");
        }

        public DataTable Hanghoa_Select_All_Vali_ForView0()
        {
            return Mapper.QueryForDataTable("Hanghoa_Select_All_Vali_ForView0", null, "Temp");
        }

        public DataTable Hanghoa_Select_All_NotVali()
        {
            return Mapper.QueryForDataTable("Hanghoa_Select_All_NotVali", null, "Temp");
        }

        public DataTable Hanghoa_Select_By_Id_Hanghoa(Guid Id)
        {
            return Mapper.QueryForDataTable("Hanghoa_Select_By_Id_Hanghoa", Id, "Temp");
        }

        public DataTable Hanghoa_Select_Soluong_By_Id_Hanghoa(Guid Id)
        {
            return Mapper.QueryForDataTable("Hanghoa_Select_Soluong_By_Id_Hanghoa", Id, "Temp");
        }

        public bool Hanghoa_Insert(DAL.Entities.Hanghoa hh)
        {
            try
            {
                _sqlMapper.Insert("Hanghoa_Insert", hh);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public bool Hanghoa_Update(DAL.Entities.Hanghoa hh)
        {
            try
            {
                _sqlMapper.Update("Hanghoa_Update", hh);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public DataTable Hanghoa_Select_Kiemtrama(string Ma)
        {
            return Mapper.QueryForDataTable("Hanghoa_Select_Kiemtrama", Ma, "Temp");
        }

        public bool Hanghoa_Delete0_Update(Guid Id)
        {
            try
            {
                _sqlMapper.Update("Hanghoa_Delete0_Update", Id);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public bool Hanghoa_Delete1_Update(Guid Id)
        {
            try
            {
                _sqlMapper.Update("Hanghoa_Delete1_Update", Id);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public bool Hanghoa_Delete(Guid Id)
        {
            try
            {
                _sqlMapper.Delete("Hanghoa_Delete", Id);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public bool Hanghoa_Update_SoluongGianhap(DAL.Entities.Hanghoa hh)
        {
            try
            {
                _sqlMapper.Update("Hanghoa_Update_SoluongGianhap", hh);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}
